package com.demo.order.feign;

import com.demo.order.feign.fallback.ProductFeignClientFallback;
import com.demo.product.bean.Product;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;


@FeignClient(value = "service-product",fallback = ProductFeignClientFallback.class)//feign客户端//给什么微服务发请求
public interface ProductFeignClient {
    //MVC注解的二套使用逻辑
    //1.标注在Controller上，是接收这样的请求
    //2.标注在FeignClient上，是发送这样的请求
//    @GetMapping("api/product/product/{id}")
    @GetMapping("/product/{id}")
    Product getProductById(@PathVariable("id") Long id, @RequestHeader String  token);


}
